<template>
  <div>
    <van-nav-bar
      :z-index="999"
      :fixed="true"
      left-arrow
      @click-left="onClickLeft"
      :placeholder="true"
      title="学车学堂"
    ></van-nav-bar>

    <!-- 手风琴效果 -->
    <van-collapse v-model="activeName" :accordion="true">
      <van-collapse-item
        v-for="(item, index) in lists"
        :key="index"
        :name="index + 1"
      >
        <template #title>
          <div class="accordion">
            <img :src="item.picaddress" />
            <div class="accordion_video">
              <p>{{ item.title }}</p>
              <div>
                <p>共{{ item.countj }}节</p>
                <div>
                  <img src="../../assets/images/64.png" alt />
                  <p>{{ item.djl }}</p>
                </div>
              </div>
            </div>
          </div>
        </template>
        <!-- 内容 -->
        <div
          class="accordion_content"
          v-for="(i, index1) in item.carclassdirVoList"
          :key="index1"
          @click="href('/CardSchool', i.id)"
        >
          <div>
            <img :src="i.picaddress" alt />
            <p>{{ i.title }}</p>
          </div>
          <div class="accordion_right">
            <div>{{ i.title }}</div>
            <p>观看量 {{ i.djl }}</p>
            <!-- <p>未观看</p> -->
          </div>
        </div>
        <!-- end -->
      </van-collapse-item>
      <!--  -->
    </van-collapse>
  </div>
</template>

<script>
// 引入config.js
import { baseURL } from "../../assets/js/config";
import { CardList } from "../../assets/js/api/exam";
export default {
  name: "EvenMore",
  data() {
    return {
      activeName: 1,
      lists: []
    };
  },

  mounted() {
    this.Lists();
  },
  methods: {
    // 接口的调用
    Lists() {
      this.baseURL = baseURL;
      CardList().then(res => {
        console.log(res);
        this.lists = res.data;
        // console.log(this.lists);
      });
    },
    onClickLeft() {
      this.$router.go(-1);
    },
    href(url, lid) {
      this.$router.push({ path: `${url}/${lid}/${this.$route.params.type}` });
    }
  },
  created() {
    let dsBridge = require("dsbridge");
    dsBridge.call("goBack", "", function() {
      history.go(-1);
    });
  }
};
</script>

<style></style>
